package com.bosssoft.trainee.nontax.service;

import com.alibaba.fastjson.JSONObject;
import com.bosssoft.trainee.nontax.common.result.Result;
import com.bosssoft.trainee.nontax.entity.dto.TokenResult;
import com.bosssoft.trainee.nontax.entity.dto.UserInfo;
import com.bosssoft.trainee.nontax.entity.vo.RoleVo;
import com.bosssoft.trainee.nontax.entity.vo.UserVo;
import com.bosssoft.trainee.nontax.hystrix.RoleClientServiceFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author Luo Wenlong
 * @date 2022-07-02 19:50
 * @description:
 * @version:
 */
@Component
@FeignClient(value = "NONTAX-PROVIDER", fallbackFactory = RoleClientServiceFallBackFactory.class)
public interface RoleClientService {
    @GetMapping("/role/getAll")
    Result<List<RoleVo>> getAllRoles();

    @GetMapping("/user/getUserById")
    Result<UserVo> getUserById(Integer id);

    @RequestMapping("/user/login")
    Result<TokenResult> login(JSONObject jsonObject);

    @RequestMapping("/user/info")
    Result<UserInfo> getInfo(String token);
}
